<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="绩效考核" name="first">
        <common-table ref="firstRef" :rulesType="0"></common-table>
      </el-tab-pane>
      <el-tab-pane label="工作任务" name="second">
        <common-table ref="secondRef" :rulesType="1"></common-table>
      </el-tab-pane>
      <el-tab-pane label="培训活动" name="third">
        <common-table ref="thirdRef" :rulesType="2"></common-table>
      </el-tab-pane>
      <el-tab-pane label="其他活动" name="fourth">
        <common-table ref="fourthRef" :rulesType="3"></common-table>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import commonTable from '@/views/system/rules/commonTable'

export default {
  name: "Index",
  components: {
    commonTable
  },
  data() {
    return {
      activeName: 'first'
    }
  },
  methods: {
    handleClick(tab) {
      const tabName = tab.name
      if (tabName === 'first') {
        this.$refs.firstRef.getList()
      } else if (tabName === 'second') {
        this.$refs.secondRef.getList()
      } else if (tabName === 'third') {
        this.$refs.thirdRef.getList()
      } else if (tabName === 'fourth') {
        this.$refs.fourthRef.getList()
      }
    }
  }
}
</script>

<style scoped>

</style>
